import cv2 as cv


class MatchFace:
    def __init__(self):
        self.classifier = cv.CascadeClassifier('haarcascade_frontalface_default.xml')

    def deal(self, frame):
        gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
        faces = self.classifier.detectMultiScale(gray, 1.3, 6)
        for (x, y, w, h) in faces:
            cv.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)
        return frame
